package com.wj.tool.common.bean;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.Basic;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

public abstract class BaseEntity implements Serializable {
    private static final long serialVersionUID = 1036557977895326616L;
    protected Date createTime;
    protected Date updateTime;
    protected Long createUser;
    protected Long updateUser;
    protected Boolean deleted;

    public BaseEntity() {
        this.deleted = Boolean.FALSE;
    }

    @Basic
    @CreatedDate
    @Column(
            name = "create_time"
    )
    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Basic
    @LastModifiedDate
    @Column(
            name = "update_time"
    )
    public Date getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @CreatedBy
    @Column(
            name = "create_user",
            length = 50
    )
    public Long getCreateUser() {
        return this.createUser;
    }

    public void setCreateUser(Long createUser) {
        this.createUser = createUser;
    }

    @Basic
    @LastModifiedBy
    @Column(
            name = "update_user",
            length = 50
    )
    public Long getUpdateUser() {
        return this.updateUser;
    }

    public void setUpdateUser(Long updateUser) {
        this.updateUser = updateUser;
    }

    @Basic
    @Column(
            name = "deleted",
            length = 4,
            nullable = false
    )
    public Boolean getDeleted() {
        return this.deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
}
